<template>
  <div>
    <el-drawer
      title="考勤详情"
      :visible.sync="drawer"
      direction="rtl"
      size="50%"
      :before-close="handleClose"
      class="drawerBox"
    >
      <el-table :data="tableData" border stripe>
        <el-table-column prop="fullName" label="姓名" align="center"> </el-table-column>
        <el-table-column label="日期" align="center">
          <template slot-scope="scope">
            {{ scope.row.clockDate }}
          </template>
        </el-table-column>
        <el-table-column label="上午上班时间" align="center">
          <template slot-scope="scope">
            {{ scope.row.morningStartTime }}
            {{ scope.row.morningStartStatus }}
          </template>
        </el-table-column>
        <el-table-column label="上午下班时间" align="center">
          <template slot-scope="scope">
            {{ scope.row.morningEndTime }}
            {{ scope.row.morningEndStatus }}
          </template>
        </el-table-column>
        <el-table-column label="下午上班时间" align="center">
          <template slot-scope="scope">
            {{ scope.row.afternoonStartTime }}
            {{ scope.row.afternoonStartStatus }}
          </template>
        </el-table-column>
        <el-table-column label="下午下班时间" align="center">
          <template slot-scope="scope">
            {{ scope.row.afternoonEndTime }}
            {{ scope.row.afternoonEndStatus }}
          </template>
        </el-table-column>
      </el-table>
      <!-- <el-calendar v-model="value"> </el-calendar> -->
    </el-drawer>
  </div>
</template>

<script>
import * as api from '@/api/project'
export default {
  props: {
    listData: {
      default: () => {
        return {}
      },
      type: Object,
    },
    time: {
      default: '',
      type: String,
    },
  },
  data() {
    return {
      drawer: false,
      tableData: [],
      value: new Date(),
    }
  },
  watch: {
    drawer(e) {
      if (e) {
        this.getList()
      }
    },
  },
  methods: {
    // 获取列表
    getList() {
      let data = {
        userId: this.listData.userId,
        queryDate: this.time,
      }
      api.attendanceInfo(data).then(res => {
        if (res.code == '200') {
          this.tableData = res.data
        }
      })
    },
    handleClose() {
      this.drawer = false
    },
  },
}
</script>

<style lang="scss" scoped>
.drawerBox {
  ::v-deep .el-drawer__body {
    padding: 20px;
  }
  .rowBox {
    margin-bottom: 20px;
  }
}
.pageBox {
  width: 600px;
  margin-top: 10px;
  text-align: center;
}
</style>
